#!/usr/bin/python
#-*- coding: utf-8 -*-
#encoding=utf-8
import urllib2
import urllib
import os
import sys
from BeautifulSoup import BeautifulSoup


def getAllImageLink():

    html = urllib2.urlopen(sys.argv[1]).read()
    soup = BeautifulSoup(html)
    liResult = soup.findAll('img')#,attrs={"width":"175"}
    #print liResult 方便调试

    count = 0;
    for image in liResult:
        count += 1
        link = image.get('src')
        imageName = count
        filesavepath = './img/%s.jpg' % imageName
        urllib.urlretrieve(link,filesavepath)
        print filesavepath 

if __name__ == '__main__':
    getAllImageLink()
